package groupb6.shopsystem.messaging.entity;

import groupb6.shopsystem.pojo.entity.User;
import groupb6.shopsystem.util.enums.IdentityEnum;
import lombok.Data;
import lombok.Getter;

import java.util.Objects;

/*
 * 聊天室标识
 * @Author zhangyn
 * */


public class Key {
private final String key;
    public Key(User seller, User customer){
        if(!Objects.equals(seller.getIdentity(), IdentityEnum.SELLER.getIdentity())
                || !Objects.equals(customer.getIdentity(), IdentityEnum.BUYER.getIdentity())){
            throw new RuntimeException("Key初始化失败：传入参数校验错误");
        }
        this.key="key: "+seller.getId()+customer.getId();
    }
    public String getKey(){
        return this.key;
    }
}
